package com.youxue.service;

import com.youxue.dao.InteractionMapper;
import com.youxue.entity.Interaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by ACER on 2018/1/25.
 */
@Service("Interaction")
public class InteractionServiceImpl implements InteractionService {
    @Autowired
    InteractionMapper interactionMapper;

    @Override
    public Interaction selectByPrimaryKey(Integer id) {
        return interactionMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Interaction> showOnePersonReview(Integer dynamicId, Integer replayId) {
        return interactionMapper.showOnePersonReview(dynamicId, replayId);
    }

    @Override
    public int insertSelective(Interaction interaction) {
        return interactionMapper.insertSelective(interaction);
    }

    @Override
    public int insertReview(Integer interactionUserId, Integer dynamicId, Integer replayId, String dynamicComment) {
        return interactionMapper.insertReview(interactionUserId,dynamicId,replayId,dynamicComment);
    }

    @Override
    public List<Interaction> whatchMyNews(Integer replayId) {
        return interactionMapper.whatchMyNews(replayId);
    }

    @Override
    public int whatchMyNewsCount(Integer replayId) {
        return interactionMapper.selectMyNewsCount(replayId);
    }

    @Override
    public int readAInteraction(Integer interactionId) {
        return interactionMapper.updateAInteractionRead(interactionId);
    }

    @Override
    public int readListInteraction(Integer replayId) {
        return interactionMapper.updateListInteraction(replayId);
    }

    @Override
    public int deleteListInteractions(Integer dynamicId) {
        return interactionMapper.deleteInteractions(dynamicId);
    }

    @Override
    public Interaction showAInteractionInfo(Integer interactionId) {
        return interactionMapper.selectAInteractionInfo(interactionId);
    }

    @Override
    public int addADynamicInteraction(Interaction interaction) {
        return interactionMapper.insertSelective(interaction);
    }

    @Override
    public int deleteADynamicInteraction(Integer interactionId) {
        return interactionMapper.deleteAImmediateComment(interactionId);
    }

    @Override
    public int deleteAInteraction(Integer interactionId) {
        return interactionMapper.deleteByPrimaryKey(interactionId);
    }

    @Override
    public List<Interaction> showADynamicAllCommentByPage(Integer dynamicId,Integer startPos,Integer pageSize) {
        return interactionMapper.selectADynamicAllCommentByPage(dynamicId,startPos,pageSize);
    }

    @Override
    public int showADynamicAllCommentCount(Integer dynamicId) {
        return interactionMapper.selectADynamicAllCommentCount(dynamicId);
    }

    @Override
    public int aCommentAllInteractionCount(Integer interactionId) {
        return interactionMapper.selectACommentAllInteractionCount(interactionId);
    }

    @Override
    public List<Interaction> showACommentAllInteractionByPage(Integer interactionId, Integer startPos, Integer pageSize) {
        return interactionMapper.selectACommentAllInteractionByPage(interactionId,startPos,pageSize);
    }


}
